package com.cloud.DrugManagement.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.cloud.DrugManagement.pojo.OrderContent;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
 * @author zhozixiong
 * @date 2023/02/09
 */
@Mapper
@Repository
public interface OrderContentMapper extends BaseMapper<OrderContent> {

    Page<OrderContent> submitSearch(Page page, @Param("oid") Long oid);

    Page<OrderContent> notSubmitSearch(Page page, @Param("oid") Long oid, @Param("sid") int sid);

    List<OrderContent> searchOidDidPrice(@Param("oid") Long oid, @Param("sid") int sid);

    int updateQuantityByOidAndDid(@Param("quantity") int quantity, @Param("oid") long oid, @Param("did") int did);

    int updatePriceByOidAndDid(@Param("oid") long oid, @Param("did") int did, @Param("price") double price);

    @Override
    int insert(@Param("order") OrderContent orderContent);

    int delByOidAndDid(@Param("oid") long oid, @Param("did") int did);

    int delByOid(@Param("oid") long oid);
}
